const { resolve } = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
  // 入口文件
  entry: resolve(__dirname, "../src/index.js"),
  module: {
    rules: [
      {
        test: /\.eason$/,
        exclude: /(node_modules|bower_components)/,
        use: [
          './eason-webpack/index.js'
        ]
      },
      {
        test: /\.js$/,
        exclude: /(node_modules|bower_components)/,
        use: [
          'babel-loader',
        ]
      },
      {
        test: /\.less$/,
        use: [{
          loader: "style-loader" // creates style nodes from JS strings
        }, {
          loader: "css-loader" // translates CSS into CommonJS
        }, {
          loader: "less-loader" // compiles Less to CSS
        }]
      },
    ],
  },
  // // 插件
  plugins: [
    new HtmlWebpackPlugin({
      // 复制模板，并...
      template: "./public/index.html",
      // 输出目录及名称
      filename: "./index.html"
    }),
  ],
  resolve: {
    alias: {
      Eason: resolve(__dirname, '../eason'),
    },
  }
};
